from datetime import datetime
import os
from attr import dataclass
from dotenv import load_dotenv

load_dotenv()

bot_key = os.getenv('BOT_KEY')
chat_default = [os.getenv('CHAT_DEFAULT')]
chunk_default = 3
delta_day_default = 90
    
@dataclass
class AdditionalMessages:
    menu_tasks = "Let's check you tasks"
    menu_types = "Let's check your types"
    menu_subtypes = "Let's check your subtypes"
    menu_settings = "Let's check your settings"
    menu_characteristics = "Let's check your characteristics"

@dataclass
class ButtonsInput:
    button_present = '✅'
    button_empty = '❌'
    button_types = 'Types 🪢'
    button_subtypes = 'Subtypes 🧶'
    button_settings = 'Settings 🛠'
    button_help = 'Help ❓'
    button_support = 'Support 💵'
    button_tasks = 'Tasks 📔'
    button_edit = 'Edit 🖌'
    button_move_subtype = 'Move Tasks'
    button_show_tasks = 'Show Tasks' 
    button_characteristics = 'Characteristics 📈'
    button_previous = '⬅️'
    button_next = '➡️'
    button_expired = 'Expired 😴'
    button_finished = 'Finished 🏁'
    button_processing = 'Process 🕑'
    button_change_type = 'Change Type'
    button_change_subtype = 'Change Subtype'
    button_add_timing = 'Add Timing'
    button_return_expired = 'Make as Proccessing'
    button_return_finished = 'Repeat Task'
    button_return_processing = 'Make as Done'
    button_change_tasks_frequency = 'Change Frequency'
    button_show_datetime = 'With us From:'
    button_show_processing = 'Processing'
    button_show_expired = 'Expired'
    button_show_finished = 'Finished'
    button_morning = "Morning"
    button_day = "Day"
    button_evening = "Evening"
    button_default_task_group = 'Default Tasks Grouping:'
    button_default_task_day = 'Default Tasks Datetime Notification:'
    button_default_task_show = 'Default Tasks Show:'
    button_default_task_frequency = 'Default Task Frequency:'
    button_default_add_timing = 'Default Task Add Timing:'
    
@dataclass
class GroupingTasksMenu:
    text_menu = 'Your Menu:'
    group_task = 'Group by Tasks'
    group_types = 'Group by Types'
    group_subtypes = 'Group by Subtypes'
    default_types = 'Types as Default'
    default_subtypes = 'Subtypes as Default'
    default_task = 'Tasks as Default'
    default_select_all = 'Select All'
    default_back = 'Back from Default'
    text_select_unkwown = 'Select Grouping of the Tasks:'
    text_group_subtypes = 'Grouped by SubTypes Tasks:'
    text_group_types = 'Grouped by Types Tasks:'
    text_group_task_by = 'Grouped by Task:'
    text_group_task = 'Your Tasks:'
    text_show_types_user = 'Your Types:'
    text_show_subtypes_user = 'Your SubTypes:'
    text_show_setting = 'Your Settings:'
    text_show_statistics = 'Your Statistics:'
    expired_task_desc_processing = 'Your Proccessing Tasks:'
    expired_task_desc_expired = 'Your Expired Tasks:'
    expired_task_desc_finished = 'Your Finished Tasks:'
    text_change_task_type = 'Change Type of the Task To:'
    text_change_task_subtype = 'Change SubType of the Task To:'
    text_move_all_type_to_another = 'Move all tasks to another type'
    text_move_all_subtype_to_another = 'Move all tasks to another subtype'
    text_change_frequency = 'Change Frequency of your Task to:'
    text_change_frequency_default = 'Change Default Frequency to:'
    text_updated_default_frequency = "We successfully updated values of the default frequency"
    text_start = 'Welcome to the Task Organizer Bot.\n' +\
                'Here you can sent every backlog and check them after by the notifications.\n' +\
                f'Also,\n - by using {ButtonsInput.button_settings} you can get and set your profile like you want;\n' +\
                f'- by using {ButtonsInput.button_characteristics} you can get your own basic statistic values;\n' +\
                f'- by using {ButtonsInput.button_tasks}, {ButtonsInput.button_types}, {ButtonsInput.button_subtypes} '+\
                'you can make basic manipulations of you previpously provided messages.\nTry it out and good luck.'  

@dataclass
class Callbacks:
    callback_empty = '000'
    callback_settings = '001'
    callback_types = '002'
    callback_select_all = '1110'
    callback_types_group = '111'
    callback_subtypes_group = '112'
    callback_task_group = '113'
    callback_types_default = '114'
    callback_subtypes_default = '115'
    callback_task_default = '116'
    callback_types_selection = '117'
    callback_subtypes_selection = '118'
    callback_task_selection = '119'
    callback_update_types = '220'
    callback_update_subtypes = '221'
    callback_update_tasks = '222'
    callback_update_tasks_alarm = '223'
    callback_update_tasks_types = '224'
    callback_update_tasks_subtypes = '225'
    callback_update_tasks_frequency = '226'
    callback_update_tasks_frequency_next = '227'
    callback_info_types = '300'
    callback_info_subtypes = '301'
    callback_info_tasks = '302'
    callback_remove_user_type = '310'
    callback_remove_user_subtype = '311'
    callback_task_make_done = '320'
    callback_task_make_repeat = '321'
    callback_task_make_unexpired = '322'
    callback_task_change_frequency = '323'
    callback_task_add_timing = '324'
    callback_task_change_type = '325'
    callback_task_change_subtype = '326'
    callback_task_new_type = '327'
    callback_task_new_subtype = '328'
    callback_task_new_type_next = '329'
    callback_task_new_subtype_next = '330'
    callback_move_task_by_types = '331'
    callback_move_task_by_subtypes = '332'
    callback_find_move_task_types = '333'
    callback_find_move_task_subtypes = '334'
    callback_next_move_task_types = '335'
    callback_next_move_task_subtypes = '336'
    callback_show_tasks_by_types = '400'
    callback_show_tasks_by_subtypes = '401'
    callback_show_next_types = '500'
    callback_show_next_subtypes = '501'
    callback_show_next_task = '502'
    callback_settings_next = '600'
    callback_settings_change_frequency = '601'
    callback_settings_new_frequency = '602'
    callback_settings_group_default = '603'
    callback_settings_group_task = '604'
    callback_settings_group_types = '605'
    callback_settings_group_subtypes = '606'
    callback_settings_change_add_timing = '607'
    callback_settings_change_showings = '608'
    callback_settings_change_datetime_not = '609'
    callback_next_task_group_tasks = '701'
    callback_next_task_group_types = '702'
    callback_next_task_group_subtypes = '703'
    
@dataclass
class FilesUsage:
    folder_current = os.getcwd()
    folder_storage = 'storage'
    folder_name_db = 'database.sql'
    file_name_json = 'clock.json'
    
@dataclass
class DataBaseTable:
    table_user = 'User'
    table_task = 'Task'
    table_type = 'Type'
    table_subtype = 'SubType'
    table_notification = 'Notification'

    table_task_type = 'TaskType'
    table_task_subtype = 'TaskSubType'
    table_task_processing = 'TaskProcessing'
    table_task_finished = 'TaskFinished'
    table_task_expired = 'TaskExpired'
    table_type_subtype = 'TypeSubType'
    table_task_notification = 'TaskNotification'
    table_subtype_notification = 'SubTypeNotification'
    table_type_user = 'TypeUser'
    table_subtype_user = 'SubTypeUser'
    table_user_settings = 'UserSettings'

@dataclass
class TableUser:
    id = 'id'
    name_first = 'name_first'
    name_last = 'name_last'
    username = 'username'
    datetime = 'datetime'

@dataclass
class TableTask:
    id = 'id'
    id_user = 'id_user'
    id_user_task = 'id_user_task'
    id_message = 'id_message'
    datetime_start = 'datetime_start'
    datetime_finish = 'datetime_finish'
    description_start = 'description_start'
    description_finish = 'desription_finish'
    alarm_day = 'alarm_day'
    alarm_morning = 'alarm_morning'
    alarm_evening = 'alarm_evening'

@dataclass
class TableNotification:
    id = 'id'
    type = 'type'
    description = 'description'
    notice_day_one = 'notice_day_one'
    notice_week_one = 'notice_week_one'
    notice_week_two = 'notice_week_two'
    notice_week_three = 'notice_week_three'
    notice_week_four = 'notice_week_four'
    notice_month_one = 'notice_month_one'

@dataclass
class TableType:
    id = 'id'
    name = 'name'

@dataclass
class TableSubType:
    id = 'id'
    name = 'name'

@dataclass
class TableTaskProccessing:
    id = 'id'
    id_user = 'id_user'
    datetime = 'datetime_started'

@dataclass
class TableTaskFinished:
    id = 'id'
    id_user = 'id_user'
    datetime = 'datetime_finished'

@dataclass
class TableTaskExpired:
    id = 'id'
    id_user = 'id_user'
    datetime = 'datetime_expired'

@dataclass
class TableTypeSubType:
    id_type = 'id_type'
    id_subtype = 'id_subtype'

@dataclass
class TableTaskType:
    id_task = 'id_task'
    id_type = 'id_type'

@dataclass
class TableTaskSubType:
    id_task = 'id_task'
    id_subtype = 'id_type'

@dataclass
class TableTypeUser:
    id_type = 'id_type'
    id_user = 'id_user'

@dataclass
class TableSubTypeUser: 
    id_subtype = 'id_subtype'
    id_user = 'id_user'

@dataclass
class TableSubTypeNotification:
    id_subtype = 'id_subsystem'
    id_notification = 'id_notification'

@dataclass
class TableTaskNotification:
    id_task = 'id_task'
    id_notification = 'id_notification'

@dataclass
class TelegramCommands:
    start = 'start'
    menu = 'menu'
    help = 'help'
    tasks = 'tasks'
    types = 'types'
    subtypes = 'subtypes'
    settings = 'settings'
    support = 'support'
    add_types = 'add_types'
    add_subtypes = 'add_subtypes'
    characteristics = 'characteristics'

@dataclass
class TableUserSettings:
    id_user = 'id_user'
    add_timing = 'add_timing'
    show_processing = 'show_processing'
    show_expired = 'show_expired'
    show_finished = 'show_finished'
    default_by_types = 'default_by_types'
    default_by_subtypes = 'default_by_subtypes'
    default_by_tasks = 'default_by_tasks'
    default_frequency = 'default_frequency'
    default_change_morning = 'default_change_morning'
    default_change_day = 'default_change_day'
    default_change_evening = 'default_change_evening'

basic_value_task_type = 7
basic_value_task_subtype = 6
basic_value_task_notification = 1

basic_id_types = [1, 2, 3, 4, 5, 6, 7, 8, 9]
basic_id_subtypes = [1, 2, 3, 4, 5, 6, 7, 8]
basic_id_types_non_rem = [9]
basic_id_subtypes_non_rem = [8]

basic_values_type = [
    {
        'id': 1,
        'name': 'Work',
    },
    {
        'id': 2,
        'name': 'Study',
    },
    {
        'id': 3,
        'name': 'Sport',
    },
    {
        'id': 4,
        'name': 'Personal',
    },
    {
        'id': 5,
        'name': 'Information',
    },
    {
        'id': 6,
        'name': 'Humour',
    },
    {
        'id': 7,
        'name': 'Improvement',
    },
    {
        'id': 8,
        'name': 'Music',
    },
    {
        'id': 9,
        'name': 'Unknown',
    }
]
basic_values_subtype = [
    {
        'id': 1,
        'name': "Document",
    },
    {
        'id': 2,
        "name": "Link",
    },
    {
        'id': 3,
        "name": "Picture",
    },
    {
        'id': 4,
        "name": "Video",
    },
    {
        'id': 5,
        "name": "Audio",
    },
    {
        'id': 6,
        "name": "Text",
    },
    {
        'id': 7,
        "name": "Book",
    },
    {
        'id': 8,
        'name': 'Unknown',
    }
]

basic_values_notification = [
    [
        1,
        'Everyday', 
        'Notice user everyday in every cases',
        True,
        False,
        False,
        False,
        False,
        False
    ],
    [
        2,
        'Every Week', 
        'Notice user every week in every cases which could apply',
        False,
        True,
        False,
        False,
        False,
        False
    ],
    [
        3,
        'Every Two Weeks', 
        'Notice user every second week in every cases which could apply',
        False,
        False,
        True,
        False,
        False,
        False
    ],
    [
        4,
        'Every Three Weeks', 
        'Notice user every third week in every cases which could apply',
        False,
        False,
        False,
        True,
        False,
        False
    ],
    [
        5,
        'Every Four Weeks', 
        'Notice user every fourth week in every cases which could apply',
        False,
        False,
        False,
        False,
        True,
        False
    ],
    [
        6,
        'Every Month', 
        'Notice user every month in every cases which could apply',
        False,
        False,
        False,
        False,
        False,
        True
    ]
]

basic_value_task = [
    1,
    'Task which is required to you to get familiar with out bot and get the default values of it',
    True,
    True,
    True
]

basic_id_frequency = basic_values_notification[0][0]
basic_add_timings = [1, 3, 4, 7, 14, 21]

content_react_basic = [
    'audio', 
    'document', 
    'photo', 
    'sticker', 
    'video', 
    'video_note', 
    'voice', 
    'location', 
    'contact', 
    'pinned_message']